package main

import "fmt"

func main() {
	vals := []int{1, 3, 4, 5, 6, 4, 3, 5}
	fmt.Println(max(vals...))
	fmt.Println(min(vals...))
	fmt.Println(maxAndMin(vals...))
}

func max(arr ...int) int {
	temp := arr[0]
	for _, v := range arr {
		if temp < v {
			temp = v
		}
	}
	return temp
}

func min(arr ...int) int {
	temp := arr[0]
	for _, v := range arr {
		if temp > v {
			temp = v
		}
	}
	return temp
}

func maxAndMin(arr ...int) (max, min int) {
	max = arr[0]
	min = arr[0]
	for _, v := range arr {
		if max < v {
			max = v
		}
		if min > v {
			min = v
		}
	}
	return max, min
}
